/* 
 *      Token.java
 *
 *      Copyright 2008 Pablo Nicolas Diaz Bilotto <pablonicolas.diaz@gmail.com>
 *
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *      (at your option) any later version.
 *
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */
package lexer.token;


/**
 * The Class Token.
 */
public abstract class Token extends BaseToken {

	/** The Line nro. */
	private int LineNro;

	/** The Kind. */
	private TokenEnum Kind;

	/**
	 * Instantiates a new token.
	 * 
	 * @param Ln the ln
	 * @param Kind the kind
	 */
	public Token(int Ln, TokenEnum Kind) {
		this.LineNro = Ln;
		this.setKind(Kind);
	}

	/**
	 * Gets the kind.
	 * 
	 * @return the kind
	 */
	protected TokenEnum getKind() {
		return Kind;
	}

	/**
	 * Gets the line nro.
	 * 
	 * @return the line nro
	 */
	public int getLineNro() {
		return LineNro;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see lexer.token.BaseToken#getValue()
	 */
	public abstract Object getValue();

	/**
	 * Sets the kind.
	 * 
	 * @param kind the new kind
	 */
	protected void setKind(TokenEnum kind) {
		Kind = kind;
	}

	/**
	 * Sets the line nro.
	 * 
	 * @param lineNro the new line nro
	 */
	protected void setLineNro(int lineNro) {
		LineNro = lineNro;
	}

	/**
	 * Token_to_yacc.
	 * 
	 * @return the int
	 */
	public abstract int token_to_yacc();

	/*
	 * (non-Javadoc)
	 *
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "LINE : " + Integer.toString(this.LineNro) + " : "
				+ this.getValue().toString();
	}

}
